package mt.client;

import java.util.ArrayList;

import mt.Order;

public class OrderResume {


	private ArrayList<Order> orders;

	public OrderResume( ){
		super();
		this.orders = new ArrayList<Order>();
		start();

	}
	
	public ArrayList<Order> getOrders() {
		return orders;
	}

	public void setOrders(ArrayList<Order> orders) {
		this.orders = orders;
	}
	
	public ArrayList<Order> getBuyOrders(){
		ArrayList<Order> buyOrders = new ArrayList<Order> ();
		for(Order order : this.orders){
			if(order.isBuyOrder()){
				buyOrders.add(order);
			}
			
		}
		return buyOrders;
	}
	
	public ArrayList<Order> getSellOrders(){
		ArrayList<Order> sellOrders = new ArrayList<Order> ();
		for(Order order : this.orders){
			if(order.isSellOrder()){
				sellOrders.add(order);
			}
			
		}
		return sellOrders;
	}

/**
 * simulates sell and buy orders sent by the server
 */
	public void start(){
	        Order sellOrder1 = Order.createSellOrder("Person4", "EDP", 10, 100.00);        
	        Order sellOrder2 =Order.createSellOrder("Person3", "GALP", 10, 200.00);
	        Order sellOrder3 =Order.createSellOrder("Person2", "BRISA", 10, 300.00);
	        Order sellOrder4 =Order.createSellOrder("Person1", "EDP", 10, 400.00);
	        Order buyOrder1 = Order.createBuyOrder("Person8", "EDP", 10, 100.00);    
	        Order sellOrder5 = Order.createSellOrder("P14", "PT", 10, 100.00);
	        Order buyOrder2 =Order.createBuyOrder("Person7", "GALP", 10, 200.00);
	        Order buyOrder3 =Order.createBuyOrder("P9", "BRISA", 10, 1200.00);
	        Order buyOrder5 =Order.createBuyOrder("P10", "BRISA", 10, 1300.00);
	        Order buyOrder6 =Order.createBuyOrder("P11", "BRISA", 10, 1300.00);
	        Order buyOrder7 =Order.createBuyOrder("P12", "BRISA", 500, 1300.00);
	        Order buyOrder8 =Order.createBuyOrder("p13", "BRISA", 10, 1300.00);
	        Order buyOrder4 =Order.createBuyOrder("Person5", "EDP", 10, 400.00);
        
	        orders.add(sellOrder1);
	        orders.add(sellOrder2);
	        orders.add(sellOrder3);
	        orders.add(sellOrder4);
	        orders.add(sellOrder5);
	        orders.add(buyOrder1);
	        orders.add(buyOrder2);
	        orders.add(buyOrder3);
	        orders.add(buyOrder4);
	        orders.add(buyOrder5);
	        orders.add(buyOrder6);
	        orders.add(buyOrder7);
	        orders.add(buyOrder8);
	        
	}
	@Override
	public String toString() {
		return "OrderResume [orders=" + orders + "]";
	}
	
	


}
